﻿using System;

namespace System
{
    public static class EventHandlerExtension
    {
        public static void TriggerEvent(this EventHandler handler, object sender)
        {
            if (handler != null)
            {
                var e = EventArgs.Empty;
                handler(sender, e);
            }
        }
        public static void TriggerEvent<TEventArgs>(this EventHandler<TEventArgs> handler, object sender, TEventArgs e) 
            where TEventArgs : EventArgs
        {
            if (handler != null)
            {
                handler(sender, e);
            }
        }
    }
}
